package com.gxa.controller;


import com.gxa.common.R;
import com.gxa.entity.SysUser;
import com.gxa.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/sysUser")
@Api(value = "test",tags = "业务")
public class SysController {

    @Autowired
    SysUserService sysUserService;
    @RequestMapping("/aalogin")
    @ResponseBody
    @ApiOperation(value = "用户登录接口",notes = "验证用户的用户名和密码",httpMethod = "POST", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "username",value = "用户名",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "password",value = "密码",paramType = "query",dataType = "String",required = true)
    })
    public R  login(String username, String password, HttpServletResponse response){
        R select = sysUserService.select(username, password, response);
        return select;
    }
    @RequestMapping("/select")
    @ResponseBody
    public R  select(){
        R r = sysUserService.selectAll();
        return  r;
    }
    @RequestMapping("/update")
    @ResponseBody
    public R update(){
        R r = new R();
        r.setCode(200);
        r.setMsg("修改成功");
        return r;
    }

}
